import django_filters
from .models import *


class SupplierFilter(django_filters.rest_framework.FilterSet):
    """
    供应商的过滤类
    """

    class Meta:
        model = Supplier
        fields = []


class ProductFilter(django_filters.rest_framework.FilterSet):
    """
    供应商的过滤类
    """
    C011 = django_filters.NumberFilter(field_name="C011", lookup_expr='lte', help_text="光板 下限")
    C001 = django_filters.NumberFilter(field_name="C001", lookup_expr='gte', help_text="光板 上限")
    C012 = django_filters.NumberFilter(field_name="C012", lookup_expr='lte', help_text="钢板 下限")
    C002 = django_filters.NumberFilter(field_name="C002", lookup_expr='gte', help_text="钢板 上限")
    C013 = django_filters.NumberFilter(field_name="C013", lookup_expr='lte', help_text="亚克力 下限")
    C003 = django_filters.NumberFilter(field_name="C003", lookup_expr='gte', help_text="亚克力 上限")
    C014 = django_filters.NumberFilter(field_name="C014", lookup_expr='lte', help_text="玻璃 下限")
    C004 = django_filters.NumberFilter(field_name="C004", lookup_expr='gte', help_text="玻璃 上限")
    B001 = django_filters.CharFilter(field_name="B001", help_text="基材")
    B002 = django_filters.CharFilter(field_name="B002", lookup_expr='icontains', help_text="类别")
    B003 = django_filters.CharFilter(field_name="B003", lookup_expr='icontains', help_text="胶系")
    B004 = django_filters.CharFilter(field_name="B004", lookup_expr='icontains', help_text="颜色")
    B005 = django_filters.CharFilter(field_name="B005", lookup_expr='icontains', help_text="结构")
    B006 = django_filters.CharFilter(field_name="B006", lookup_expr='icontains', help_text="厚度")

    class Meta:
        model = ProductSource
        fields = ['C001', 'C002', 'C003', 'C004', 'C011', 'C012', 'C013', 'C014', 'B001', 'B002', 'B003', 'B004',
                  'B005', 'B006']
